import { createBrowserRouter, RouterProvider } from 'react-router-dom'
import Home from '@/pages/Home'
import ErrorPage from '@/error-page'
import Login from '@/pages/Login'
import About from '@/pages/About'
import User from '@/pages/User'
import App from '@/App'
import Test from '@/pages/Test'
import Form from '@/pages/Form'
import List from '@/pages/List'

const Router = () => {
	const routes = createBrowserRouter([
		{
			path: '/',
			element: <App />,
			errorElement: <ErrorPage />,
			children: [
				{
					index: true, // 设置默认子路由
					// path: 'home',
					element: <Home />,
				},
				{
					path: 'about',
					element: <About />,
				},
				{
					path: 'user',
					element: <User />,
				},
				{
					path: 'test',
					element: <Test />,
				},
				{
					path: 'form',
					element: <Form />,
				},
				{
					path: 'list',
					element: <List />,
				},
			],
		},
		{
			path: '/login',
			element: <Login />,
		},
	])
	return <RouterProvider router={routes} />
}
export default Router
